﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

//
using InterfacesInstanceClustering;

namespace MyKeywordFilter
{
    public partial class MinorKeywordFilterPlugin : UserControl, IKeywordFilter
    {
        public MinorKeywordFilterPlugin()
        {
            InitializeComponent();            
        }

        private IInstanceClusteringHost pluginHost = null;
        public IInstanceClusteringHost PluginHost
        {
            get
            {
                return pluginHost;
            }
            set
            {
                this.pluginHost = value;
            }
        }

        private string pluginName = "Minor Keyword Filter";
        public string PluginName
        {
            get
            {
                return this.pluginName;
            }
        }

        private string pluginDescription = "Filter Keywords which do not appear frequently.";

        public string PluginDescription
        {
            get { return pluginDescription; }
            set { pluginDescription = value; }
        }

        public UserControl PluginUserControl
        {
            get
            {
                return this;
            }
        }

        public void Initialize()
        {
            SetParameter();
        }

        public void PluginDispose()
        {
        }

        private MyKeywordFilterPlugin_1_Form parametersForm = new MyKeywordFilterPlugin_1_Form();

        public void SetParameter()
        {
            parametersForm.ShowDialog();
        }

        public bool IsDesirableKeyword(DTO.Keyword keyword)
        {        
            if (keyword.Count >= parametersForm.MinimumNumOfAppearance)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}
